<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>倒计时器</title>
</head>
<body>
	<div id="showtime"></div>
</body>
<script language="javascript" type="text/javascript">

	var T = function(dname,hname,mname,sname)
	{
		this.setTime = "2013/04/01 09:00:00";
		this.showBoxId = "showtime";
		this.dname = dname ? dname : '天';
		this.hname = hname ? hname : '小时';
		this.mname = mname ? mname : '分钟';
		this.sname = sname ? sname : '秒';
		this.clock = function()
		{
			var NowDate = new Date();
			var BeDate=new Date(this.setTime);
			var time=(BeDate.getTime()-NowDate.getTime())/1000;
			var day = Math.floor(time/(24*3600));
				this.html = day + this.dname;
			var hour = Math.floor((time - day *24*3600)/3600);
				this.html += hour + this.hname;
			var minute = Math.floor((time - day*24*3600 - hour*3600)/60);
				this.html += minute + this.mname;
			var secend = Math.floor(time - day*24*3600 - hour*3600 - minute*60);
				this.html += secend + this.sname;
		}

		this.showIt = function()
		{
			this.clock();
			document.getElementById(this.showBoxId).innerHTML = this.html;
		}
	}
	var t = new T;
	t.showIt();
	setInterval('t.showIt()',1000);
</script>
</html>